package com.platform.usercenter.controller;

import java.util.List;
import java.io.IOException;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//import com.platform.common.log.annotation.Log;
//import com.platform.common.log.enums.BusinessType;
import com.platform.common.security.annotation.RequiresPermissions;
import com.platform.usercenter.domain.SysDeptTax;
import com.platform.usercenter.service.ISysDeptTaxService;
import com.platform.common.core.web.controller.BaseController;
import com.platform.common.core.web.domain.AjaxResult;
import com.platform.common.core.utils.poi.ExcelUtil;
import com.platform.common.core.web.page.TableDataInfo;

/**
 * 组织税号Controller
 *
 * @author platform
 * @date 2023-09-19
 */
@RestController
@RequestMapping("/sysDeptTax")
public class SysDeptTaxController extends BaseController
{
    @Resource
    private ISysDeptTaxService sysDeptTaxService;

    /**
     * 查询组织税号列表
     */
    @RequiresPermissions("usercenter:sysDeptTax:list")
    @GetMapping("/list")
    public TableDataInfo list(SysDeptTax sysDeptTax)
    {
        startPage();
        List<SysDeptTax> list = sysDeptTaxService.selectSysDeptTaxList(sysDeptTax);
        return getDataTable(list);
    }

    /**
     * 导出组织税号列表
     */
    @RequiresPermissions("usercenter:sysDeptTax:export")
    //@Log(title = "组织税号", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysDeptTax sysDeptTax)
    {
        List<SysDeptTax> list = sysDeptTaxService.selectSysDeptTaxList(sysDeptTax);
        ExcelUtil<SysDeptTax> util = new ExcelUtil<SysDeptTax>(SysDeptTax.class);
        util.exportExcel(response, list, "组织税号数据");
    }

    /**
     * 获取组织税号详细信息
     */
    @RequiresPermissions("usercenter:sysDeptTax:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysDeptTaxService.selectSysDeptTaxById(id));
    }

    /**
     * 新增组织税号
     */
    @RequiresPermissions("usercenter:sysDeptTax:add")
    //@Log(title = "组织税号", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysDeptTax sysDeptTax)
    {
        return toAjax(sysDeptTaxService.insertSysDeptTax(sysDeptTax));
    }

    /**
     * 修改组织税号
     */
    @RequiresPermissions("usercenter:sysDeptTax:edit")
    //@Log(title = "组织税号", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysDeptTax sysDeptTax)
    {
        return toAjax(sysDeptTaxService.updateSysDeptTax(sysDeptTax));
    }

    /**
     * 删除组织税号
     */
    @RequiresPermissions("usercenter:sysDeptTax:remove")
    //@Log(title = "组织税号", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysDeptTaxService.deleteSysDeptTaxByIds(ids));
    }
}
